package model;
// Generated 18/06/2013 21:29:27 by Hibernate Tools 3.2.1.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.faces.bean.ManagedBean;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Dependente generated by hbm2java
 */
@ManagedBean(name = "dependente")
@Entity
@Table(name = "dependente", catalog = "trabalhohibernate")
public class Dependente extends Pessoa implements java.io.Serializable {

    private Integer id;
    private String email;
    private Cliente cliente;

    public Dependente() {
    }

    public Dependente(String nome, String cpf, String email, String endereco, Date dataNascimento, Set<Cliente> clientes) {
        this.nome = nome;
        this.cpf = cpf;
        this.email = email;
        this.endereco = endereco;
        this.dataNascimento = dataNascimento;

    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "nome")
    @Override
    public String getNome() {
        return this.nome;
    }

    @Override
    public void setNome(String nome) {
        this.nome = nome;
    }

    @Column(name = "cpf")
    @Override
    public String getCpf() {
        return this.cpf;
    }

    @Override
    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    @Column(name = "email")
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name = "endereco")
    @Override
    public String getEndereco() {
        return this.endereco;
    }

    @Override
    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "dataNascimento", length = 10)
    @Override
    public Date getDataNascimento() {
        return this.dataNascimento;
    }

    @Override
    public void setDataNascimento(Date dataNascimento) {
        this.dataNascimento = dataNascimento;
    }

    @Override
    public String toString() {
        return this.getNome();
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 31 * hash + getId().intValue();
        hash += (getId() != null ? getId().hashCode() : 7);
        return hash;
    }

    @Override
    public boolean equals(Object object) {

        if (!(object instanceof Dependente)) {
            return false;
        }
        Dependente other = (Dependente) object;
        if ((this.getId() == null && other.getId() != null)
                || (this.getId() != null
                && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    /**
     * @return the cliente
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "codCliente")
    public Cliente getCliente() {
        return cliente;
    }

    /**
     * @param cliente the cliente to set
     */
    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
    }
}
